<template>
  <div class="aideBox">
    <el-popover placement="left" trigger="hover">
      <div>
        <div class="content" style="width: 120px; line-height: initial">
          已接入<span style="color: #1c5ea4">AI大模型</span>，帮你智能分析报告，快来试试！
        </div>
      </div>
      <div class="aide" slot="reference" @click="drawer = true">
        <div class="icon">
          <i class="iconfont count_icon icon-zixun"></i>
        </div>
        <div class="name">AI报告分析</div>
      </div>
    </el-popover>



    <div class="AIdrawer">
      <el-drawer
        :modal="false"
        :wrapperClosable="false"
        :visible.sync="drawer"
        direction="rtl"
        :size="widthsize"
        :withHeader="false"
      >
        <div class="title">
          <div class="name">AI报告分析</div>
          <div @click="drawer = false">
            <i class="icon-toggle iconfont count_icon" />
          </div>
        </div>
        <aikefuAli2></aikefuAli2>
      </el-drawer>
    </div>
  </div>
</template>

<script>
import aikefuAli2 from "../aiHtml/aikefuAli2.vue";

export default {
  name: "ai",
  components: { aikefuAli2 },
  data() {
    return {
      drawer: false,
      widthsize: "480px",
      windowWidth: window.innerWidth,
      dialogTableVisible: false,
    };
  },
  methods: {
    iceAi() {
      this.windowWidth = window.innerWidth;
      if (this.windowWidth > 768) {
        // this.dialogTableVisible = true;
      } else {
        window.location.href = `weixin://dl/business/?appid=wx65eba4bff5c43988&path=pages/DigitalCard/index&query=q=https%3A%2F%2Faibeings-vip.xiaoice.com%2Fapplet%3FprojectId%3D37824835-c41f-11ef-9e0b-b180ef3e4345&env_version=release`;
        // window.location.href = `https://aibeings-vip.xiaoice.com/api/v1/talk/url/redirect?bizCode=37824835-c41f-11ef-9e0b-b180ef3e4345`;
      }
    },
    handleResize() {
      this.windowWidth = window.innerWidth;
      if (this.windowWidth > 768) {
        this.widthsize = "480px";
      } else {
        this.widthsize = "100%";
      }
    },
  },
  beforeDestroy() {},
  mounted() {
    this.handleResize();
  },
  created() {},
};
</script>

<style lang="scss" scoped>
::v-deep .AIdrawer {
  .el-drawer__wrapper {
    left: inherit;
    width: 510px;
  }
}

.AIdrawer {
  .el-drawer__wrapper {
    left: inherit;
    width: 510px;
  }
}
.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to right, #1c5ea4, #9cccff);
  padding: 10px 15px;
  .name {
    color: #fff;
  }
  .count_icon {
    color: #fff;
    font-size: 22px;
    cursor: pointer;
  }
}

.iceAi {
  position: fixed;
  width: 75px;
  z-index: 999;
  top: 65%;
  right: 0;
  img {
    object-fit: cover;
    width: 100%;
  }
}
.aide {
  position: fixed;
  z-index: 999;
  top: 45%;
  right: 0;
  background-color: #fff;
  padding: 8px 5px 13px 5px;
  width: 40px;
  border-radius: 15px 0 0 15px;
  box-shadow: 0px 0px 20px 0px rgba(28, 94, 164, 0.4);
  cursor: pointer;
  .icon {
    background: linear-gradient(#1c5ea4, #9cccff);
    margin-bottom: 5px;
    border-radius: 20px;
    padding: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
  }
  .count_icon {
    color: #fff;
    font-size: 18px;
  }
  .name {
    text-align: center;
  }
}

@media (max-width: 750px) {
  ::v-deep .AIdrawer {
    .el-drawer__wrapper {
      width: 100%;
    }
  }

  .AIdrawer {
    .el-drawer__wrapper {
      width: 100%;
    }
  }
  .iceAi {
    width: 65px;
  }
}
</style>
